package org.bit.lesson06;

public class SingletonLazy {

    private static SingletonLazy instance = null;

    private SingletonLazy() {
    }

    /**
     * 对外提供一个获取对象的方法
     *
     * @return
     */
    public static SingletonLazy getInstance() {
        // 第一次判断是否需要加锁
        synchronized (SingletonLazy.class) {
            if (instance == null) {
                instance = new SingletonLazy();
            }
        }
        return instance;
    }
}
